/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: 性能评估器相关头文件
 * Author: qingjicheng
 * Create: 2022-8-1
 */

#ifndef CONNECTED_GRAPH_H
#define CONNECTED_GRAPH_H

#include "graph_common_def.h"
#include "connected_subgraph/connected_subgraph.h"
#include "connected_subgraph_factory.h"

namespace HcclEvaluator {

class ConnectedGraph {
public:
friend class ConnectedGraphAnalyzer;
public:
    explicit ConnectedGraph();
    virtual ~ConnectedGraph();
    HcclResult SetSubgraphAdjaMutrix(AdjacencyMatrix<> &&matrix, u32 level);
    HcclResult ParseAllSubgraphs();
private:
    HcclResult CheckSubgraphs(std::vector<std::unique_ptr<ConnectedSubgraph>> &subgraphs);
private:
    ConnectedSubgraphFactory subgraphFactory_;
    std::vector<AdjacencyMatrix<>> adjaMatrixes_;
    std::vector<std::vector<std::unique_ptr<ConnectedSubgraph>>> multiLayerSubgraphs_;
    std::vector<u32> subgraphNodeSize_; // size与层数一致,保存多层拓扑每层中子图的nodeSize,要求每层全部子图nodeSize一致
    u32 maxLevel_ = 0;
};
}
#endif